package ch.trainingtest.service.implement;

import java.util.List;

import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.jws.WebService;

import ch.trainingtest.business.TaskManagementBean;
import ch.trainingtest.dto.TaskDto;
import ch.trainingtest.dto.UserDto;
import ch.trainingtest.service.ITaskManagementService;

@WebService(serviceName = "taskManagementService", endpointInterface = "ch.trainingtest.service.ITaskManagementService")
@Stateless
public class TaskManagementService implements ITaskManagementService{

	@EJB
	private TaskManagementBean taskManagementBean;
	
	public List<TaskDto> getAllTasks() {
		return taskManagementBean.getAllTasks();
	}

	public boolean createTask(TaskDto taskDto) {
		return taskManagementBean.createTask(taskDto);
		
	}

	public boolean updateTask(TaskDto taskDto, UserDto modifiedUser) {
		return taskManagementBean.updateTask(taskDto, modifiedUser);
		
	}

	public boolean createTaskWithInfo(int uid, String title, String des, int status) {
		return taskManagementBean.createTask(uid, title, des, status);
	}

	public boolean updateTaskTest() {
		TaskDto dto = new TaskDto();
		dto.setId(1);
		dto.setStatus(1);
		dto.setTitle("Tittle 1");
		dto.setCreatedBy(new UserDto(1, "paul", "paul"));
		dto.setDescription("Description 1");
		dto.setAssignee(new UserDto(2, "barbara", "barbara"));
		
		UserDto modifyUser = new UserDto(3, "luisa", "luisa");
		
		taskManagementBean.updateTask(dto, modifyUser);
		return true;
		
	}

}
